[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 IF (BEXP) statement
  -or-
 IF (BEXP) THEN
  statement(s)
 ELSEIF (BEXP) THEN
  statement(s)
 ELSE
  statement(s)
 ENDIF

 Function
  Execute one or more statments if a condition is true.

 Syntax
  IF (BEXP) statement
  -or-
  IF (BEXP) THEN
    statement(s)
  [ELSEIF (BEXP) THEN] ' optional in a block IF
  [  statement(s)]
  [ELSEIF (BEXP) THEN] ' you may have multiple ELSEIF statement(s)
  [  statement(s)]
  [ELSE]               ' optional in a block IF
  [  statement(s)]
  ENDIF

   BEXP       - Any boolean expression.
   statement  - Any valid PPL statement.

 Remarks
  The IF statement supports two types of structures:  logical and block.
  A logical IF statement is a single statement; if a condition is TRUE,
  execute a single statement.  A block IF can be one or more statements
  with multiple conditions to test for.  The start of a block IF loop is
  differentiated from a logical IF loop by the THEN keyword immediately
  after the condition.  In a block IF statement the first condition to
  evaluate to TRUE will be executed, after which control will be
  transferred to the statement following the ENDIF.  If none of the
  conditions are TRUE by the time an ELSE statement is reached then the
  statements between the ELSE and ENDIF will be processed.  If none of the
  conditions are TRUE and an ELSE statement is never found then none of
  the conditions will be executed; instead, control will be transferred
  to the statement after the ENDIF.

 Examples
  IF (CURSEC() < 10) END ' Insufficient security, terminate execution
  IF (CURSEC() < 20) THEN
    PRINTLN "Your security is less than 20"
  ELSEIF (CURSEC() > 30) THEN
    PRINTLN "Your security is greater than 30"
  ELSEIF (CURSEC() = 25) THEN
    PRINTLN "Your security is 25"
  ELSE
    PRINTLN "Your security is level",CURSEC()
  ENDIF

See Also: FOR/NEXT WHILE/ENDWHILE
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson